<?php

class ExceptionHandler extends Exception
{
	/**
	 * Custom exception handler
	 * Example Legend for various custom exception codes below:
	 * -1: shown to user
	 * -2: thrown by code
	 * -3: unexpected/unknown
	 * -4: user session timeout(Exceptions that might require user to login again)
	 * -5: critical error which needs immediate attention !
	 * @param string $message Exception message string
	 * @param int $code Exception code
	 * @return throws Exception or keeps silent depending upon Exception type
	 */
	public  function __construct($message, $code = -2)
	{
		//write to log files if needed
		//critical exceptions can send out email/sms notifications
		
		/*
		 * unless we want to ignore some exceptions silently, we can also throw the exception again
		 * For example critical -5 code exceptions will be handled differently than others OR whatever the system requirement maybe 
		 */
		parent::__construct($message, $code);	//can pass on back to parent also if desired - NOT needed in general cases
	}
}